<%-- 
    Document   : maquina
    Created on : 24/07/2010, 18:13:21
    Author     : atila
--%>

<%@page import="org.madmac.servlet.action.Action"%>
<%@page import="org.madmac.servlet.form.Form"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- VERIFICA SE O USUÁRIO ESTÁ COM O COOKIE VÁLIDO, SENÃO O REDIRECIONA PARA A PÁGINA DE LOGIN -->
<%@ include file="/log/verify_login.jsp" %>
<!-- VERIFICA SE O USUÁRIO TEM PERMISSÃO DE ACESSAR A PÁGINA, SENÃO REDIRECIONA PARA A PÁGINA INICIAL -->
<%@include file="/log/sup_page.jsp" %>

<%@page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Máquina :: MAD MAC 1.0.1</title>
      <link rel="icon" href="/madmac/favicon.ico" type="image/x-icon" />
      <link rel="shortcut icon" href="/madmac/favicon.ico" type="image/x-icon" />
      <link rel="stylesheet" href="/madmac/menu_madmac_files/cbcscbmenu_madmac.css" type="text/css" />
      <link rel="stylesheet" href="/madmac/estilos/madmac_tables.css" type="text/css" />
      <link rel="stylesheet" href="/madmac/estilos/madmac_inputs.css" type="text/css" />
      <link rel="stylesheet" href="/madmac/estilos/madmac_others.css" type="text/css" />
      <link rel="stylesheet" href="/madmac/estilos/madmac_divs.css" type="text/css" />
      <script type="text/javascript" src="/madmac/madmacproject.js" charset="UTF-8"></script>
      <script type="text/javascript" language="javascript" src="/madmac/paginacao/js/jquery.js"></script>
      <%
         if (request.getAttribute("form") != null) {
				if (Form.ADD.equals(request.getAttribute("form"))) {
      %>      
      <link rel="stylesheet" href="/madmac/autocomplete/sugestoes.css" type="text/css" />      
      <script type="text/javascript" src="/madmac/autocomplete/bibliotecaAjax.js" charset="UTF-8"></script>
      <script type="text/javascript" src="/madmac/autocomplete/sugestoes.js" charset="UTF-8"></script>
      <script type="text/javascript" src="/madmac/common_pages/js/mad_hints.js" charset="UTF-8"></script>

      <script language="JavaScript" type="text/javascript">
         setNextField('tombamento');
         setCurrentForm('adicionar_maquina');
         setNextPage('inserir_maquina.jsp');
         mad_hint_texto += 'No Linux utilize o comando: <br/><b>- sudo lshw</b><br/><br/>';
         mad_hint_texto += 'e copie a saida para o campo <b>Modelo</b>.';
         /*changeTitle("Adicionar Máquina");*/
      </script>
      <%
            }
         } else if (request.getAttribute("action") != null) {
            if (Action.LIST_ALL.equals(request.getAttribute("action"))) {
               %>
               <!-- PAGINAÇÃO VIA AJAX -->
               <style type="text/css" title="currentStyle">
                  @import "/madmac/paginacao/css/demo_page.css";
                  @import "/madmac/paginacao/css/demo_table.css";
               </style>
               <script type="text/javascript" language="javascript" src="/madmac/paginacao/js/jquery.dataTables.js"></script>
               <script type="text/javascript" charset="utf-8">
                  $(document).ready(function() {
                     $('#example').dataTable( {
                        "sPaginationType": "full_numbers"
                     } );
                  } );
               </script>
               <%
            }
         }
      %>
	</head>
   <body>
      <div class="logotype"><img src="/madmac/madmac-logo-1.0.1.png" height="120%" alt="MAD MAC"></div>

      <div class="menu_principal">
         <%@ include file="/common_pages/menu.jsp" %>
      </div>

      <div class="search_mac">
         <%@include file="/common_pages/search_mac.jsp" %>
      </div>

      <div class="corpo">
			<%
            // form
				if (request.getAttribute("form") != null) {
					if (Form.ADD.equals(request.getAttribute("form"))) {
                  %>
                  <%@include file="/maquina/maquinaCreate.jsp" %>
                  <%
					}
            // action
				} else if (request.getAttribute("action") != null) {
               if (Action.LIST.equals(request.getAttribute("action"))) {
                  %>
                  <%@include file="/maquina/maquinaList.jsp" %>
                  <%
               } else if (Action.LIST_ALL.equals(request.getAttribute("action"))) {
                  %>
                  <%@include file="/maquina/maquinaListAll.jsp" %>
                  <%
               } else if (Action.ERROR.equals(request.getAttribute("action"))) {
						// TODO: por trecho de erro em arquivo.
						%>
							<%@include file="/common_pages/erro.jsp" %>
						<%
					}
            }
			%>
		</div>
		
		<!-- DIV QUE MOSTRA AS PESSOAS CADASTRADAS A MEDIDA QUE FOR DIGITANDO -->
      <div id="divPopup" class="sugestoes">
         <table id="tabela" bgcolor="#FFFFFF" border="0" cellspacing="0" cellpadding="0" class="semCor"></table>
      </div>
		<div id="mad_hint">
			<span id="hint_text"></span>
		</div>
		<div class="footer_madmac">
         <%@include file="/common_pages/footer.jsp" %>
      </div>
   </body>
</html>